﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DataStore;
using DataStore.Repositories;
using DataStore.Domain;

namespace UI
{
    /// <summary>
    /// Interaction logic for AddBook.xaml
    /// </summary>
    public partial class AddBook : Window
    {
        public AddBook()
        {
            InitializeComponent();
        }

        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //TextRange text = new TextRange(commentsRichTextBox.Document.ContentStart, commentsRichTextBox.Document.ContentEnd);
                //Book book = new Book()
                //{
                //    Title = titleTextBox.Text,
                //    Comments = text.Text
                //};
                //BookRepository books = new BookRepository();
                //books.Add(book);
                //this.DialogResult = true;
                //this.Close();
            }
            catch
            {
                MessageBox.Show("Failed to save this book. Please try again.", "Save book", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

        private void cancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
